package dao;

import java.sql.*;

public class MyConnection {

    private static final String userName = "root";
    private static final String password = "123456";
    private static final String url = "jdbc:mysql://localhost:3306/beatx?useUnicode=true&characterEncoding=utf-8&useSSL=false";
    public Connection connection = null;

    public MyConnection() {

    }

    public void getConnection() {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            connection = DriverManager.getConnection(url, userName, password);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void closeConnection() {
        try {
            connection.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
